package com.nep.NEPM.controller;

import com.nep.common.util.SceneSwitcherUtil;
import com.nep.entity.administrator.User;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;

import java.util.Objects;

public class ConfirmAQIContentViewController {
    @FXML
    private Button btn_OUT;
    @FXML
    private Button btn_Back;
    @FXML
    private Label lblId;          // 编号
    @FXML
    private Label lblName;        // 姓名
    @FXML
    private Label lblProvince;    // 省份
    @FXML
    private Label lblCity;        // 城市
    @FXML
    private Label lblGrade;       // 污染等级
    @FXML
    private Label lblDate;        // 日期
    @FXML
    private Label lblTime;        // 时间
    @FXML
    private Label lblPhone;
    @FXML
    private Label lblAddress;
    @FXML
    private Label lblDescription;
    @FXML
    private Label lblGridName;
    @FXML
    private Label lblGridPhone;
    @FXML
    private Label lblDegree;

    // 初始化视图数据的方法
    public void initData(User user) {
        if (Objects.isNull(user)) {
            return;
        }
        lblPhone.setText(user.getPhone());
        lblAddress.setText(user.getAddress());
        lblDescription.setText(user.getDescription());
        lblGridName.setText(user.getGridName());
        lblGridPhone.setText(user.getGridPhone());
        lblDegree.setText(user.getDegree());
        lblId.setText(user.getId());
        lblName.setText(user.getName());
        lblProvince.setText(user.getProvince());
        lblCity.setText(user.getCity());
        lblGrade.setText(user.getGrade());
        lblDate.setText(user.getDate());
        lblTime.setText(user.getTime());
    }

    public void OUT(ActionEvent actionEvent) {
        SceneSwitcherUtil.switchScene(btn_OUT, "/com/nep/NEPM/view/IndexView.fxml");
    }

    public void Back(ActionEvent actionEvent) {
        SceneSwitcherUtil.switchScene(btn_Back, "/com/nep/NEPM/view/ConfirmAQIListView.fxml");
    }
}